Sending Emails

 

When there is a requirement to email messages, the script example below shows how this can be implemented using a simple GMail SMTL server. You must have a suitable internet connection to be able to use this.

 

// Sends email using GMAIL SMTP server.
function SendEmail() {
  LogInfo("SendEmail");

  var client = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
  client.Credentials = new System.Net.NetworkCredential("[email protected]", "myAccountPwd");
  client.EnableSsl = true;
 
  var message = new System.Net.Mail.MailMessage();
  message.From = new System.Net.Mail.MailAddress("[email protected]");
  message.To.Add(new System.Net.Mail.MailAddress("[email protected]"));
  message.CC.Add(new System.Net.Mail.MailAddress("[email protected]"));
  message.Subject = "sent from Sym3 using a Server Macro";
  message.Body = "This is the body of the email";
  client.Send(message);
  LogInfo("SendEmail done");
}